<template>
	<view class="content">
		<image :class="className" src="/static/logo.png"></image>
		<view class="text-area">
			<text class="title" v-on:click="open">{{title}}</text>
		</view>
		
		<view class="input">
			<input  v-model="message" placeholder="edit me"/>
			<text>Message is: {{message}}</text>
		</view>
		
		<view>
			<view>{{ Number + 1}}</view>
			<view>{{ ok ? 'yes' : "no"}}</view>
			<view>{{ message.split('').reverse().join('')}}</view>
		</view>
	</view>
	
	<view>
		<button @click="handleClick('参数1')">按钮1</button>
		<button @click="handleClick(dynamicParam)">按钮2</button>
		<button @click="handleClick('参数A','参数B',$event)">按钮3</button>
		<button @click="(e) => handleClick('点击事件',e)">带事件对象</button>
	</view>
	
	<view class="content">
		<view v-for="item in arr" style="color: #ff0000;">
			{{item}}
		</view>
		<view v-for="(item,index) in 4" style="color: #00ff00;">
			<view :class="'list-' + index%2">{{index%2}}
			</view>
			<view v-for="(value,name,index) in object">
				{{index}}. {{name}}: {{value}}
			</view>
			<view v-for="item in arr" :Key="item.id">
				<view style="color: blue;">{{item.id}}:{{item.name}}</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title:'Hello',
				className:"smalllogo",
				Number:1, 
				ok:true,
				message:'',
				dynamicParam:"我是动态",
				
				arr:[
					
						{id:1,name:'uni-app'},
						{id:2,name:'html'},
					
				],
				Object:{
					title:'how to do lists in vue',
					authoe: 'jane doe',
					publishedAt: '2025-10-14'
				}
			};
		},
		methods: {
			open() {
				this.title = "opening a new page";
				this.className = 'logo'
			},
			
			handleClick(param1,param2,event) {
				console.log('参数1',param1)
				console.log('参数2',param2)
				console.log('事件对象',event)
			},
			
			handButton(msg,event) {
				console.log('接受的消息',msg)
				console.log('事件对象',event)
				console.log('按钮文本',event.target.textContent)
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}
	.smalllogo{
		height: 50rpx;
		width: 50rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}
	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
	
</style>
